/** 
    今日门诊记录部分
 */

 <template>
    <div style="width:1100px">
        <div style="font-weight:600">今日门诊记录</div>
        <hr>
            <!--列表-->
        <el-table size="small" :data="listData" highlight-current-row border element-loading-text="拼命加载中">
            <el-table-column prop="registerId" label="挂号单号" width="100" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="treatmentStatus" label="就诊状态" width="80" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="idcard" label="患者编号" width="160" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="patientName" label="患者姓名" width="80" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="sex" label="患者性别" width="70" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="age" label="患者年龄" width="80" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="phoneNumber" label="手机号码" width="120" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="type" label="门诊类型" width="80" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="office" label="诊断科室" width="98" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="doctorName" label="接诊医生" width="80" show-overflow-tooltip align="center"></el-table-column>
            <el-table-column prop="date" label="挂号时间" width="150" show-overflow-tooltip align="center"></el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
    </div>
</template>
<script>
import axios from "axios";
import Pagination from "../../components/Pagination";


export default {
    data(){
        return{
            // 分页参数
            pageparm: {
            currentPage: 1,
            pageSize: 10,
            total: 10,
            },
            //
            listData: [], 
            //
            outpatient: {
                createTimeFront: "",
                createTimeBack: "",
                pageNum: "",
                pageSize:"",
            },
            formInline: {
                page: 1,
                limit: 10,
            },
        }
    },
    // 注册组件
    components: {
        Pagination,
    },
    //
    methods:{

        // 分页插件事件
        callFather(parm) {
        this.formInline.page = parm.currentPage;
        this.formInline.limit = parm.pageSize;
        this.gettodayoutpatientlist();
        },
        //获得今天的门诊记录
        gettodayoutpatientlist(){

            // 今天的0时 - 24时
            let daySart = new Date();
            daySart.setHours(0);
            daySart.setMinutes(0);
            daySart.setSeconds(0);
            let dayEnd = new Date();
            dayEnd.setHours(23);
            dayEnd.setMinutes(59);
            dayEnd.setSeconds(59);
            // console.log(daySart);
            // console.log(dayEnd);
            this.outpatient.pageNum = this.formInline.page;
            this.outpatient.pageSize = this.formInline.limit;

            // 时间等于今天
            this.outpatient.createTimeFront = daySart;
            this.outpatient.createTimeBack = dayEnd;
            
            // 发送请求,查询所有的诊断日志
            axios.post("/api/outpatient/findTodayOupatients", this.outpatient)
            .then((res) => {
                console.log("res*************",res);
                this.listData = res.data.data.list;
                // console.log(this.listData);
                // 分页赋值
                this.pageparm.currentPage = this.formInline.page;
                this.pageparm.pageSize = this.formInline.limit;
                this.pageparm.total = res.data.data.total;
            })
            .catch((err) =>{
                this.$message.error('请求错误,请联系我们的管理员~~~')
            });
        }
    },
    created(){
        this.gettodayoutpatientlist();
    }
}
</script>